<template>
  <div id="home">
    <el-menu
        style="width: 200px;min-height: calc(100vh - 50px)"
        :uniqueOpened="true"
        default-active="/news"
        class="el-menu-vertical-demo"
        router
        background-color="inherit"
        text-color="#fff"
        active-text-color="#ffd04b">
      <el-submenu index="/1">
        <template #title>new project</template>
  <!--      <el-menu-item index="/user" v-if="user.role===1">用户管理</el-menu-item>-->
      </el-submenu>
      <el-menu-item index="/get">Get</el-menu-item>
      <el-menu-item index="/post">post</el-menu-item>
      <el-menu-item index="/project">project</el-menu-item>
      <el-menu-item index="/Result">result</el-menu-item>
      <el-menu-item index="/report">report</el-menu-item>
    </el-menu>
  </div>
</template>

<script>
import request from "@/utils/request";

export default {
  name: "Aside",
  data(){
    return{
      user:{},
    }
  },
  created() {
    let userStr =sessionStorage.getItem("user") || '{}';
    this.user = JSON.parse(userStr);
//请求后端服务器，确认当前登录用户的合法性
    request.get("/api/user/"+this.user.id).then(res=>{
      if (res.code==='0'){
        this.user = res.data;
      }
    });
  },
  methods:{

  }
}
</script>

<style scoped>

#home {
  width: 100vw;
  height: 100vh;
  background: url("../assets/view2.jpg") no-repeat;
  background-size: cover;
  overflow: hidden;
  opacity:0.8;
}
</style>
